ProcessForm = function(config) {

    this.processDefinitionId = config.processDefinitionId;

    this.valueData = {};
    this.formConfig = {};

    Ext.apply(this, config || {}, {
        title: 'Start process form'
    });

    Ext.applyIf(this.formConfig, {
        monitorValid:true,
        items : [],
        buttons: [{
            text: 'Submit',
            handler: this.onSend,
            scale:'medium',
            iconCls: 'button-form-upload',
            formBind: true,
            scope : this
        }, {
            text : 'Cancel',
            handler :this.close,
            scale:'medium',
            iconCls: 'button-form-cancel',
            scope : this
        }]
    });

    // Poziv konstruktora nadklase
    ProcessForm.superclass.constructor.call(this);

};

Ext.extend(ProcessForm, AbstractForm, {

    onSend : function(){
        this.getForm().submit( {
            url : DISPATCHER_CONTEXT + 'process/form',
            method : 'POST',
            params :{
                processDefinitionId : this.processDefinitionId
            },
            scope : this,
            success : this.successHandler,
            //failure : function(){alert("Greška!");},
            submitEmptyText : false
        });
    },

    successHandler : function(form, action){
        MessageBoxHandler.showInfoBox("Process started succesfully.");
        this.publish('taskRefresh');
        this.close();
    }
});

Ext.reg('processForm', ProcessForm);